package me.zk.practice1.hw;

import java.util.Scanner;

/**
 * @author zhangkai
 * @date 2023/8/4 18:18
 */
public class HWBJ02 {



        public static void main(String[] args) {

            Scanner scanner = new Scanner(System.in);

            String s = scanner.nextLine();

            String[] ss = s.split(",");

            int[] num = new int[ss.length];   //将输入放入整数数组中

            for(int m=0;m<ss.length;m++){
                num[m] = Integer.parseInt(ss[m]);
            }

            int max = 0;    //最大面积

            int l = 0;
            int r = num.length-1;
            while (l < r) {
                max = Math.max(max,Math.min(num[l],num[r])*(r-l));
                if (num[l] < num[r]) {
                    l++;
                } else {
                    r--;
                }
            }

            System.out.println(max);

        }


}
